<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>2.6.3import命令</title>
    </head>
    <body>
        <script type="module">
            //【例2.40】import命令
            //必须加type="module"
            //需同源
            import {name}from'./module.js';
            console.log(name);
            
            //【例2.41】使用import命令注意事项
            //报错
            import {'f'+'oo'}from 'my_module';

            //报错
            let module='my_module';
            import {foo} from module;

            //报错
            if(x===1){
                import {foo}from 'module1';
            }else{
                import {foo}from 'module2';
            }
        </script>
    </body>
</html>